<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- 导入依赖 -->
    <script src="https://lib.baomitu.com/jquery/2.2.4/jquery.js"></script>
    <script src="https://lib.baomitu.com/leaflet/1.9.2/leaflet.js"></script>
    <link rel="stylesheet" href="https://lib.baomitu.com/leaflet/1.9.2/leaflet.css">
    <style>
        * {
            margin: 0;
            padding: 0
        }

        #map {
            width: 100vw;
            height: 100vh;
        }
    </style>
</head>

<body>
    <div id="map">

    </div>
    <script type="module">
        import data from '/data/2023-08-29.js'
        /* 瓦片图层 */
        // var url = 'https://api.mapbox.com/styles/v1/mapbox/streets-v11/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoiY2hlbmdiZW5jaGFvIiwiYSI6ImNsODU3aGRiODA0Y2UzcHBzZmFlcmdqZ2sifQ.8k59W_pB_Riwe6o-MneRlA'
        // var layer = L.tileLayer(url, {
        //     maxZoom: 19,
        //     attribution: '© OpenStreetMap'
        // })
        // 之前的底图，就这个，它是个mapbox的底图，
        // 现在切换为高德的底图：
        // 老师的语雀笔记：高德底图：https://www.yuque.com/xzd-gis03/rules/zzzbnw
        /* 瓦片图层 */
        var layer = L.tileLayer('http://webrd0{s}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}', {
            subdomains: ['1', '2', '3', '4'],
            minZoom: 1,
            maxZoom: 19
        })
        /* 实例化地图 */
        const map = L.map("map", {
            layers: [layer],
            /* center:[纬度,经度] */
            center: [30.50, 114.30],
            zoom: 10
        })

        console.log(data) // 得到本地的geojson数据
        // 加载geojson数据
        var wuhan_layer = L.geoJSON(data);
        // 将加载好的geojson数据图层【类似一个图层管理器】添加到地图中
        map.addLayer(wuhan_layer)

    </script>
</body>

</html>